'use strict'

const domain = 'https://dev-api.lotchina.cc/', Authorization = window.sessionStorage.getItem("Authorization") ? window.sessionStorage.getItem("Authorization") : ''
var tx = 'http://static.lotchina.cc/'

let common = {
    /**
     * MUI ajax请求获取数据 默认POST请求
     */
    ajax: function (url, data, successback, errorback, type) {
        mui.ajax(domain + url,{
            data: data,
            dataType: 'json',
            type: type == undefined ? 'POST' : 'GET',
            timeout: 10000,
            headers: window.sessionStorage.getItem("Authorization") ? {'Content-Type':'application/json', 'Authorization': 'Bearer ' + Authorization} : {'Content-Type':'application/json'},                  
            success:function(data){
                successback(data)
            },
            error:function(xhr){
                errorback(xhr)
            }
        })
    }
}


// Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX25hbWUiOiIxNDA5MTIyIiwic2NvcGUiOlsib3BlbmlkIl0sImV4cCI6MTUyNzU2MzA3OCwiaWF0IjoxNTI2OTU4Mjc4LCJhdXRob3JpdGllcyI6WyJST0xFX1VTRVIiXSwianRpIjoiNjNkZDU5YWEtMTlhMy00YzZhLTlmMjktZTFiMzhmM2Y3OWM2IiwiY2xpZW50X2lkIjoid2ViX2FwcCJ9.U5Baq0VucA4BipUmbiK40qEwnFrgd7FddiJddITXIXGKkzEXw6NAfTausqttlg_AximSgO_-MAx0Fui4w04g52qR9_bBAp-anO_tr1oPwoI-gyJ2jgW3qh5epCg9Hv2d8CRBRLvmQnC5q2jmLlzH8BfN9iQispWXimlplnbp1IRpYrG1e5c8y3RSW2yPcavkPjvaWPY9Gmg23eALIeadUX8iM73fvX9nmpyp1D901N_ZuzwzfllNSLs2RHRzh1gkIaguKT1wgxHcIKCnjkiWq74vIeSOTMcVMPG960BbgkcHwzV35E86J3xjSRTrBDcbVMA47FN2Ei1tcJBUO3V0EA